package puzzle.projecteuler.p100;

import puzzle.projecteuler.ContinuedFraction;
import puzzle.projecteuler.QuadricFraction;

public class Problem064 {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
		int c = 0;
		for (int d = 1; d <= 10000; d ++) {
			if (!isSquare(d)) {
				QuadricFraction f = new QuadricFraction(0,1,1,d);
				ContinuedFraction cf = f.continuedFractionValue();
				if (cf.getRepeated().length%2 == 1) {
					c ++;					
				}
			}
		}
		System.out.println(c);
	}
	
	public static boolean isSquare(int d) {
		int t = (int)Math.sqrt(d);
		return t*t == d;
	}

}
